package com.chenyun.mq.rabbitmq.handler;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

/**
 * @author: lonni
 * @CreateTime: 2023-12-02  16:52
 * @Description:
 */
public class DefaultConfirmCallback implements RabbitTemplate.ConfirmCallback {
    /**
     * 回调
     *
     * @param correlationData 参数
     * @param ack             是否确认  发送方是否将消息发送到exchange了
     * @param cause           错误消息
     */
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        System.out.println("\n确认消息送到交换机(Exchange)结果：");
        System.out.println("相关数据：" + correlationData);
        System.out.println("是否成功：" + ack);
        System.out.println("错误原因：" + cause);

    }

}